#ifdef GL_ES
#define LOWP lowp
precision mediump float;
#else
#define LOWP  
#endif

attribute vec4 a_position;

uniform mat4 u_projectionMatrix;
uniform vec4 lightPos[60];
uniform vec4 lightColor[60];

varying vec3 v_lightColor;
varying vec4 v_lightPos;
  
varying vec4 v_texCoords;
varying vec3 v_viewRay;
void main()
{
	int i = int(a_position.w);
	v_lightColor = lightColor[i].rgb;
	vec4 data = lightPos[i];
	v_lightPos = data;
	vec4 pos = vec4((data.xyz + a_position.xyz / data.w), 1.0); 
	v_viewRay = pos.xyz; 
	v_texCoords = u_projectionMatrix * pos; 
	gl_Position = v_texCoords;
	v_texCoords.xy += v_texCoords.w;
	v_texCoords.xy *=0.5;	
}